package com.dongline.test.join;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class OrderWritable implements Writable {
    private String id;
    private String pid;
    private String name;
    private String user;

    public OrderWritable(String id, String pid, String name, String user, boolean flage) {
        this.id = id;
        this.pid = pid;
        this.name = name;
        this.user = user;
        this.flage = flage;
    }

    private boolean flage ;

    public OrderWritable() {

    }

    public boolean isFlage() {
        return flage;
    }

    public void setFlage(boolean flage) {
        this.flage = flage;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPid() {
        return pid;
    }

    public void setPid(String pid) {
        this.pid = pid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }


    @Override
    public void write(DataOutput dataOutput) throws IOException {

        dataOutput.writeUTF(id);
        dataOutput.writeUTF(pid);
        dataOutput.writeUTF(name);
        dataOutput.writeUTF(user);
        dataOutput.writeBoolean(flage);

    }

    @Override
    public String toString() {
        return "" +
                "id='" + id + '\'' +
                ", pid='" + pid + '\'' +
                ", name='" + name + '\'' +
                ", user='" + user ;
    }

    @Override
    public void readFields(DataInput dataInput) throws IOException {
        this.id=dataInput.readUTF();
        this.pid=dataInput.readUTF();
        this.name=dataInput.readUTF();

        this.user=dataInput.readUTF();
        this.flage=dataInput.readBoolean();
    }
}
